let baseUrl = 'http://localhost:8080/api/v1';

function myAjax(type, url, data, callBlack) {
    $.ajax({
        url: baseUrl + url,
        type: type,
        data: data,
        //负责设置请求头信息
        headers: {
            //将登陆接口获取到的token通过authorization发送给服务器
            'Authorization': sessionStorage.getItem('bigNewsToken')
        },
        success: function(resData) {
            //判断服务器响应回来的数据是否登录,如果没有则跳转回登录页
            if (resData.code == 403) {
                window.parent.location = 'login.html'
                    // window.parent.location = '../admin/login.html' 或者window.parent.location = './login.html'

                // console.log(window.parent.location);
                return;
            }
            callBlack(resData)

        }
    })
}

function myAjaxImg(type, url, data, callBlack) {
    $.ajax({
        url: baseUrl + url,
        type: type,
        data: data,
        contentType: false,
        processData: false,
        //负责设置请求头信息
        headers: {
            //将登陆接口获取到的token通过authorization发送给服务器
            'Authorization': sessionStorage.getItem('bigNewsToken')
        },
        success: function(resData) {
            //判断服务器响应回来的数据是否登录,如果没有则跳转回登录页
            if (resData.code == 403) {
                window.parent.location = 'login.html'
                    // window.parent.location = '../admin/login.html' 或者window.parent.location = './login.html'

                // console.log(window.parent.location);
                return;
            }
            callBlack(resData)

        }
    })
}